package com.jy.api.service.impl;

import com.jy.api.dao.CallTranDao;
import com.jy.api.dao.ProductDao;
import com.jy.api.dao.StoreDao;
import com.jy.api.domain.CallTran;
import com.jy.api.domain.Product;
import com.jy.api.domain.Store;
import com.jy.api.service.CallTranService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by xiaohua on 2018/12/1.
 */
@Service
public class CallTranServiceImpl implements CallTranService {

    @Autowired
    private StoreDao storeDao;
    @Autowired
    private ProductDao productDao;
    @Autowired
    private CallTranDao callTranDao;

    @Override
    public CallTran setCallStore(String storeId) {
        Product product = productDao.findByStoreId("3").get(0);
        Store store = storeDao.findOne(storeId);
        CallTran tran = new CallTran(store, product);
        return callTranDao.save(tran);
    }
}
